package com.example.user.customviewdemo.canvasview;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.example.user.customviewdemo.R;

import java.util.ArrayList;
import java.util.HashMap;

import butterknife.Bind;
import butterknife.ButterKnife;

public class CanvasViewActivity extends AppCompatActivity {

    @Bind(R.id.canvas_view)
    CanvasView canvasView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_canvas_view);
        ButterKnife.bind(this);

        ArrayList<HashMap<String,Object>> data = new ArrayList<>();
        HashMap<String,Object> map;
        map = new HashMap<>();
        map.put(CanvasView.TITLE,"第零项");
        map.put(CanvasView.COLOR, Color.parseColor("#DBBD44"));
        map.put(CanvasView.WEIGHT,0.6f);
        data.add(map);

        map = new HashMap<>();
        map.put(CanvasView.TITLE,"第一项");
        map.put(CanvasView.COLOR, Color.parseColor("#2AB98F"));
        map.put(CanvasView.WEIGHT,0.3f);
        data.add(map);

        map = new HashMap<>();
        map.put(CanvasView.TITLE,"第二项");
        map.put(CanvasView.COLOR, Color.parseColor("#4CB5E1"));
        map.put(CanvasView.WEIGHT,0.1f);
        data.add(map);

      /*  map = new HashMap<>();
        map.put(CanvasView.TITLE,"第三项");
        map.put(CanvasView.COLOR, Color.parseColor("#0054AB"));
        map.put(CanvasView.WEIGHT,0.4f);
        data.add(map);

        map = new HashMap<>();
        map.put(CanvasView.TITLE,"第伍项");
        map.put(CanvasView.COLOR, Color.parseColor("#4CB5E1"));
        map.put(CanvasView.WEIGHT,0.15f);
        data.add(map);*/

      /*  map = new HashMap<>();
        map.put(CanvasView.TITLE,"第四项");
        map.put(CanvasView.COLOR, Color.parseColor("#E95859"));
        map.put(CanvasView.WEIGHT,0.1f);
        data.add(map);*/

       /* map = new HashMap<>();
        map.put(CanvasView.TITLE,"第伍项");
        map.put(CanvasView.COLOR, Color.parseColor("#4C7797"));
        map.put(CanvasView.WEIGHT,0.05f);
        data.add(map);

        map = new HashMap<>();
        map.put(CanvasView.TITLE,"第伍项");
        map.put(CanvasView.COLOR, Color.parseColor("#4CB5E1"));
        map.put(CanvasView.WEIGHT,0.1f);
        data.add(map);

        map = new HashMap<>();
        map.put(CanvasView.TITLE,"第伍项");
        map.put(CanvasView.COLOR, Color.parseColor("#4C7797"));
        map.put(CanvasView.WEIGHT,0.05f);
        data.add(map);*/

        canvasView.setData(data);
    }
}
